Skip to content

Fix workbench theme switcher against current and upcoming SharpConsoleUI#36

Merged
woksin merged 1 commit into
Cratis:mainfrom
nickprotop:fix/theme-switcher-registry-compat
Jun 20, 2026
Merged

Fix workbench theme switcher against current and upcoming SharpConsoleUI#36
woksin merged 1 commit into
Cratis:mainfrom
nickprotop:fix/theme-switcher-registry-compat

Conversation

@nickprotop

Copy link
Copy Markdown
Contributor

Summary

The Chronicle Workbench theme switcher built themes by concrete type
(new ClassicTheme(), new ModernGrayTheme()) and by reflective type
name (SharpConsoleUI.Plugins.DeveloperTools.DevDarkTheme). The upcoming
SharpConsoleUI release removes ClassicTheme, moves DevDarkTheme out of
the library, and replaces the static ThemeRegistry with a per-instance
windowSystem.ThemeRegistryService — so the current code stops compiling
against it.

This resolves the theme API at runtime through a small reflection bridge,
so the same source compiles and runs against both the current package
and the next release
. The package reference is unchanged.

Changed

  • Theme switching now goes through a new WorkbenchThemes helper that uses
    the version-stable ThemeStateService.SwitchTheme(name) and resolves the
    theme catalogue from whichever registry the running version exposes
    (per-instance ThemeRegistryService, falling back to the static
    ThemeRegistry) via reflection.
  • The F9 / F10 / F11 primary themes are resolved per version: the current
    package keeps the original Modern Gray / Classic / Dev Dark; the next
    release maps to Modern Gray / Forest / Crimson (Classic and Dev Dark
    no longer exist there). The Help menu gains a More Themes submenu
    listing every registered theme, and the keyboard-shortcuts overlay
    reflects the active primary themes.

Note: the reflection bridge in WorkbenchThemes is intentionally
temporary — it exists only to span the 2.4.78 → 2.4.79 transition. Once
the SharpConsoleUI dependency is pinned to 2.4.79+ and 2.4.78 is no
longer supported, it can be simplified to direct ThemeRegistryService
calls and the static-registry / Dev Dark fallbacks removed.

Note: I could not produce a full local build — this repo's source
generators require a newer Roslyn than my local SDK ships (CS9057), so
generator-emitted symbols are unavailable in my environment (this also
affects a clean upstream/main checkout, independent of this change).
The theme files were verified to compile against both the current
SharpConsoleUI package and a build of the next release, and the runtime
version-resolution (primary slots and registry enumeration) was tested
against both. CI with the project's toolchain should build normally.

@nickprotop nickprotop force-pushed the fix/theme-switcher-registry-compat branch from 843a1d3 to e21e47e Compare June 20, 2026 12:19
The Help-menu and keyboard theme switchers built themes by concrete type
(new ClassicTheme(), new ModernGrayTheme()) and by reflective type name
(SharpConsoleUI.Plugins.DeveloperTools.DevDarkTheme). SharpConsoleUI's
upcoming release removes ClassicTheme, moves DevDarkTheme out of the
library, and replaces the process-global static ThemeRegistry with a
per-instance windowSystem.ThemeRegistryService. Referencing any of those
types directly compiles against only one version.

Resolve everything at runtime through a new WorkbenchThemes helper so the
same source compiles and runs against both versions. Theme application
uses the version-stable ThemeStateService.SwitchTheme(name). The three
primary F9/F10/F11 slots are resolved per version: on the current package
they keep the original Modern Gray / Classic / Dev Dark behaviour; on the
next release, where Classic and Dev Dark no longer exist, they map to
Modern Gray / Forest / Crimson. The Help menu also gains a "More Themes"
submenu listing every registered theme, and the keyboard-shortcuts overlay
reflects whichever primary themes are active.

The reflection bridge is temporary and scoped to the 2.4.78 -> 2.4.79
transition; once the dependency is pinned to 2.4.79+ it can be simplified
to direct ThemeRegistryService calls.
@nickprotop nickprotop force-pushed the fix/theme-switcher-registry-compat branch from e21e47e to 80e065b Compare June 20, 2026 12:22
@woksin woksin added the patch label Jun 20, 2026
@woksin woksin merged commit 80e167b into Cratis:main Jun 20, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants